<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/style.css">
    <style>
        .container {
            width: 60%;
        }
        .item {
            font-size: 1em;
            padding: 10px 0;
        }
    </style>
</head>
<body>
    <h3>fr 关键字</h3>
    <h4>1. 简单例子</h4>
    <pre>
        .container {
            grid-template-columns: 1fr 1fr 1fr;
        }
    </pre>
    <div class="container" style="grid-template-columns: 1fr 1fr 1fr;">
        <div class="item">宽1fr<br>占据1/3</div>
        <div class="item">宽1fr<br>占据1/3</div>
        <div class="item">宽1fr<br>占据1/3</div>
        <div class="item">宽1fr<br>占据1/3</div>
    </div>
    <h4>2. 如果有固定尺寸值，则划分剩余空间大小</h4>
    <pre>
        .container {
            grid-template-columns: 200px 1fr 1fr 1fr;
        }
    </pre>
    <div class="container" style="grid-template-columns: 200px 1fr 1fr 1fr;">
        <div class="item">宽200px</div>
        <div class="item">宽1fr</div>
        <div class="item">宽1fr</div>
        <div class="item">宽1fr</div>
    </div>
    <h4>3. 和auto混用</h4>
    <pre>
        .container {
            grid-template-columns: auto 1fr 1fr 1fr;
        }
    </pre>
    <div class="container" style="grid-template-columns: auto 1fr 1fr 1fr;">
        <div class="item">宽auto</div>
        <div class="item">宽1fr</div>
        <div class="item">宽1fr</div>
        <div class="item">宽1fr</div>
    </div>
    <h4>3. 和auto混用, fr的值小于1</h4>
    <pre>
        .container {
            grid-template-columns: auto 0.25fr 0.25fr 0.25fr;
        }
    </pre>
    <div class="container" style="grid-template-columns: auto 0.25fr 0.25fr 0.25fr;">
        <div class="item">宽auto</div>
        <div class="item">宽0.25fr</div>
        <div class="item">宽0.25fr</div>
        <div class="item">宽0.25fr</div>
    </div>
</body>
</html>
</body>
</html>